Repository navigation
fix(browser): surface sidecar failures and keep builds alive past request timeouts - #1173
Open
linus-liu-web wants to merge 1 commit into
Open
linus-liu-web wants to merge 1 commit into
linus-liu-web wants to merge 1 commit into
Conversation
…uest timeouts Opening the Agent browser panel on a Compose install whose first sidecar image build outlives the request reports "当前运行环境不支持,或 Chromium 不可用", and the build itself is cancelled with the request: the ensure request caps at 4 minutes, the 15-minute image build context was derived from it, so docker build is killed and leaves a defunct builder, then the next attempt rebuilds from scratch. The runtime helper drops every error to a warning, so neither the panel nor the logs show the build failure. Return the real reason to interactive callers and keep the build running: - add runtime.EnsureSandboxBrowserWithError; EnsureSandboxBrowser keeps the failure-tolerant node behavior and the existing warning event; - report the underlying error from engine.ensureRunBrowser, and reuse runtime.ErrBrowserDisabled for the disabled deployment; - build the sidecar image on a context detached from the caller cancellation, and say the image is ready when the caller expired first. Refs Tencent#1160
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion: #1172 documents the Agent browser sidecar and its prebuild path; this PR fixes the underlying failure reporting and build cancellation.
What changed
On a Compose install, opening the Agent browser panel while the first sidecar image build outlives the request ends with the misleading message
Agent 浏览器启动失败:当前运行环境不支持,或 Chromium 不可用, and the build is cancelled with the request.internal/httpapi/browser.gocaps anensurerequest at 4 minutes.internal/runtime/browser.goderived the 15-minute sidecar build context from that request context, so when the request expireddocker buildwas killed and left[docker-buildx] <defunct>; the next attempt rebuilt from scratch.runtime.EnsureSandboxBrowserturns every error into a warning event and returns nil, andengine.ensureRunBrowserturned nil into the generic unsupported-environment message, so neither the panel nor the logs showed the build failure.Changes:
runtime.EnsureSandboxBrowserWithError, which returns the browser plus the real reason it is unavailable.EnsureSandboxBrowserkeeps the failure-tolerant node behavior (nil result and the existingbrowser.unavailablewarning event), so optional in-node browser tooling is unchanged.engine.ensureRunBrowsernow returnsAgent 浏览器启动失败:<real cause>, so the panel shows the build error (the image build error already carries the tail of the Docker output) instead of a fixed message.runtime.ErrBrowserDisabledreplaces the duplicated disabled string.context.WithTimeout(context.WithoutCancel(ctx), 15*time.Minute), so an interactive timeout only stops waiting: the image build completes and the next request starts the browser immediately. If the caller expired while the image was built, the returned error says the image is ready and asks to reopen the browser.Refs #1160.
Scope
Compatibility
No API, schema or runner-protocol change. Interactive browser failures now report the underlying cause instead of a fixed message;
EnsureSandboxBrowserkeeps its existing signature and behavior for node execution. The detached build can outlive a cancelled request for up to 15 minutes, bounded by the existing image-build timeout.Validation
go vet ./internal/runtime ./internal/enginepasses;gofmtclean.go test ./internal/runtime -run 'TestAgentBrowserBuildOutlivesRequestTimeout|TestEnsureSandboxBrowserWithError' -count=1docker build browser image ... connection timed outthrough the error-returning helper, whileEnsureSandboxBrowserstill returns nil;go test ./internal/engine -run 'Browser|Conversation' -count=1passes.go test ./internal/runtime -count=1: one failure,TestLocalWorkspaceGitDiscoveryCannotReachParent, reproduced identically on the unmodified base commit (d58a85a); it is pre-existing and unrelated to this change.python3 scripts/check-public.pypasses.ensureblocked for ~240 s and returned the generic Chromium message with no image and a defunct builder; after a manual long build, the sameensurereturnedavailable: truein ~2 s.go test -p=2 ./...(the repository requires building the embedded chatbot frontend first).Safety